#include "ScriptStdlib.hpp"

namespace Script
{
	void InitStdlib()
	{
		BindNativeFunction("return", 1, 1, &Return);
		BindNativeFunction("repeat", 1, 1, &Repeat);
		BindNativeFunction("print", 1, 1, &Print);
		BindNativeFunction("printl", 1, 1, &Printl);
		return;
	}
	
	std::string Print(FunctionCall Data)
	{
		std::string StringParam = Data.Vars.at(0).StringValue;

		printf("%s", StringParam.c_str());
		return StringParam;
	}
	std::string Printl(FunctionCall Data)
	{
		std::string StringParam = Data.Vars.at(0).StringValue;

		printf("%s\n", StringParam.c_str());
		return StringParam;
	}
	std::string Repeat(FunctionCall Data)
	{
		int IntParam = Str2Int(Data.Vars.at(0).StringValue);

		return Int2Str(IntParam);
	}
	std::string Return(FunctionCall Data)
	{
		std::string StringParam = Data.Vars.at(0).StringValue;

		CParen.Keyword = StringParam;
		return StringParam;
	}
}
